package config;/*
 *@author wenqh
 *@date 2024/4/9 10:24
 *@Description
 */

import interCeptors.MyInterCeptor1;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Component
public class MyWebMvcConfigurer implements WebMvcConfigurer {
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        //配置注解驱动/静态资源处理器等非自定义配置
        configurer.enable();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自定义拦截器
        registry.addInterceptor(new MyInterCeptor1()).addPathPatterns("/**");
    }
}
